﻿namespace ZFramework.Runtime
{
    public class PacketC2S : Packet
    {
        public static int EventId = typeof(PacketC2S).GetHashCode();
        
        public override int Id
        {
            get { return EventId; }
        }

        public int ReqId
        {
            get;
            private set;
        }
        
        public string MsgName
        {
            get;
            private set;
        }
        
        public byte[] Data
        {
            get;
            private set;
        }

        public PacketC2S()
        {
            
        }
        
        public static PacketC2S Create(int reqId, string msgName, byte[] data)
        {
            PacketC2S packetC2S = ReferencePool.Acquire<PacketC2S>();
            packetC2S.ReqId = reqId;
            packetC2S.MsgName = msgName;
            packetC2S.Data = data;
            
            return packetC2S;
        }

        public override void Clear()
        {
            ReqId = 0;
            MsgName = string.Empty;
            Data = null;
        }
    }
}